home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlx_sq15.zip / QDIAL.SLT < prev    next >
Text File  |  1990-12-28  |  10KB  |  279 lines

  1. //-----------------------------------------------------------
  2. // QDIAL.SL? Quick Dial or (if online) option setting.
  3. //
  4. // Hint: Define a softkey to trigger this file (use ALT-K).
  5.  
  6.  
  7. // Please look at the comments through the whole file, and modify to
  8. // suit your needs, BEFORE you use it. Then recompile with CS QDIAL.
  9.  
  10. // If you have suggestions for improving this script, please suggest
  11. // improvements to me via old-fashioned snail-mail to:
  12.  
  13. //   Inge Vabekk
  14. //   Hamangskogen 108
  15. //   N-1300 SANDVIKA
  16. //   NORWAY                   
  17. //-----------------------------------------------------------
  18.  
  19. str line [80]       
  20.    ,name [64]       
  21.    ,version[]="Telix_Square 1.5"
  22.    ,display[]="DISPLAY"      // Display script.
  23.    ,global []="GLOBAL"
  24.    ,logon  []="LOGON"        // Logon script.
  25.    ,passw  []="PASSWORD"     // Password script.
  26.    ,join   []="JOINCONF"     // Join Conference script.
  27.    ,ring   []="RING"         // Script to do the actual calling.
  28.    ,exit   []="EXIT"         // Name of EXIT script.
  29.    ,ssl    []="SSL"          // Name of SSL script.
  30.    ,bbsname[]="BNAME"        // Global for
  31.    ,prompt []="PROMPT"       // Command prompt.
  32.    ,cprot  []="CPROT"        // Current protocol
  33.    ,maxup  []="MAXUP"        // Max no. of upload files.
  34.    ,maxdn  []="MAXDN"        // Max no. of download files.
  35.    ,graph  []="GRAPH"        // Graphics Y/N.
  36.    ,logof  []="LOGOF"        // Auto logoff Y/N
  37.    ,logoff []="LOGOFF"       // Script for auto logoff toggle
  38.                              // (Note the difference!)!
  39.    ,Aexit  []="EXIT"         // Auto Exit Y/N
  40.    ,change []="CHANGE"       // Defined if status display changed.
  41.    ,startime [ 6]            // Start time.
  42.    ,temp     [12]            // Help string.
  43.    ;
  44.  
  45. int lines;  
  46.  
  47. //-----------------------------------------------------------
  48. // Script starts here.
  49. //-----------------------------------------------------------
  50.  
  51. main()
  52. {
  53. int i, col;
  54.  
  55.   entry();
  56.  
  57.   newdir (_telix_dir); // Make sure we're in the TELIX main directory.
  58.  
  59.   keyset (0x2d00,0,"@Exit");             // Alt-X is Toggle Exit flag.
  60.   keyset (0x1000,0,"@Logoff");           // Alt-Q is Toggle Logoff flag.
  61.  
  62.   if (!is_loaded(global))                // Load "Global" script
  63.   { load_scr (global);                   // permanently.
  64.     if (!is_loaded(global))              // Loaded?
  65.     { i = nosuccess(global);             // No success:
  66.       goto quit;
  67.     }
  68.   }
  69.  
  70.   if (!is_loaded (ssl))                  // Load "SSL" script
  71.   { load_scr (ssl);                      // permanently.
  72.     if (!is_loaded(ssl))                 // Loaded?
  73.     { i = nosuccess(ssl);                // No success:
  74.       goto quit;
  75.     }
  76.   }
  77.  
  78.   call (global,"W",Change,"NO");         // Show changes now.
  79.   run ("CRDIR","LOG",2);                 // Try to create logfile dir.
  80.   run ("CRDIR","CAT",2);                 // and catalog dir.
  81.   if (call (global,"R",prompt,temp) <=0) // Check for first time in script.
  82.   { getenv ("BBSNAME",name);             // Get name of BBS to call.
  83.     if (name > " ")                      // Auto logoff if name given.
  84.       call (global,"W",logof,"YES");
  85.     else
  86.       call (global,"W",logof,"NO");
  87.     call (global,"W",prompt,"Command");  // Set some defaults.
  88.     call (global,"W",cprot,"Z");         // Protocol: Zmodem.
  89.     call (global,"W",maxup,"10");        // Max no. for upload.
  90.     call (global,"W",maxdn,"10");        // Max no. for download.
  91.     call (global,"W",graph,"NO");        // Graphics
  92.     call (global,"W",Aexit,"NO");        // Auto Exit.
  93.     if (call ("GETNAME"))
  94.     { tone (80,80);                      // No success:
  95.       clear_scr();
  96.       box (17,7,58,14,176,1,15);
  97.       box (19,8,56,13,177,1,15);
  98.       box (21,9,54,12,178,1,15);
  99.       pstraxy (" USER DATA OR SCRIPT NOT FOUND! ",22,10,79);
  100.       pstraxy (" Edit user data file and retry! ",22,11,79);
  101.       gotoxy (0,24);
  102.       i = -1;
  103.       goto quit;
  104.     }
  105.     lines = call(ssl);                   // Save status line, get line number.
  106.  
  107.     if (!is_loaded(logon))               // Load "logon" script
  108.     { load_scr (logon);                  // permanently.
  109.       if (!is_loaded(logon))             // Loaded?
  110.       { i = nosuccess(logon);            // No success:
  111.         goto quit;
  112.       }
  113.     }
  114.  
  115.     if (!is_loaded(passw))               // Load password script
  116.     { load_scr (passw);                  // permanently.
  117.       if (!is_loaded (passw))            // Loaded?
  118.       { i = nosuccess (passw);           // No success:
  119.         goto quit;
  120.       }
  121.     }
  122.  
  123.     if (!is_loaded(join))                // Load join conference script
  124.     { load_scr (join);                   // permanently.
  125.       if (!is_loaded (join))             // Loaded?
  126.       { i = nosuccess (join);            // No success:
  127.         goto quit;
  128.       }
  129.     }
  130.  
  131.     if (!is_loaded(display))             // Load display script 
  132.       load_scr (display);                // permanently.
  133.     if (!is_loaded(logoff))              // Load "logoff" script 
  134.       load_scr (logoff);                 // permanently.
  135.   }
  136.  
  137.   lines = call (ssl);                    // Restore status line.
  138.   call (display);                        // Update status.
  139.  
  140. // If no BBS name, get it.
  141.  
  142.   while (!name)
  143.   { _back_color = 0;
  144.     _fore_color = 14;
  145.     col = _back_color+1;
  146.     clear_scr();
  147.     pstraxy ("▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓  ▓▓        ▓▓  ▓▓▓     ▓▓▓",1,1,col);
  148.     pstraxy ("   ▓▓     ▓▓        ▓▓        ▓▓    ▓▓   ▓▓  ",1,2,col);
  149.     pstraxy ("   ▓▓     ▓▓▓▓▓▓    ▓▓        ▓▓     ▓▓▓▓▓   ",1,3,col);
  150.     pstraxy ("   ▓▓     ▓▓        ▓▓        ▓▓    ▓▓   ▓▓  ",1,4,col);
  151.     pstraxy ("   ▓▓     ▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓  ▓▓  ▓▓▓     ▓▓▓",1,5,col);
  152.                                                                           
  153.     pstraxy (" ▓▓▓▓▓▓   ▓▓▓▓▓▓   ▓▓    ▓▓   ▓▓▓▓▓▓   ▓▓▓▓▓▓    ▓▓▓▓▓▓▓",19,18,col);
  154.     pstraxy ("▓▓       ▓▓    ▓▓  ▓▓    ▓▓  ▓▓    ▓▓  ▓▓   ▓▓   ▓▓     ",19,19,col);
  155.     pstraxy (" ▓▓▓▓▓▓  ▓▓    ▓▓  ▓▓    ▓▓  ▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓    ▓▓▓▓▓  ",19,20,col);
  156.     pstraxy ("      ▓▓ ▓▓   ▓▓▓  ▓▓    ▓▓  ▓▓    ▓▓  ▓▓   ▓▓   ▓▓     ",19,21,col);
  157.     pstraxy (" ▓▓▓▓▓▓   ▓▓▓▓▓ ▓▓  ▓▓▓▓▓▓   ▓▓    ▓▓  ▓▓    ▓▓  ▓▓▓▓▓▓▓",19,22,col);
  158.     
  159.     box (64,1,75,5,2,0,64);
  160.     box (4,18,15,22,2,0,64);
  161.     box (20,7,63,16,2,0,31);
  162.     box (18,8,61,15,2,0,31);
  163.     box (16,9,59,14,2,0,31);
  164.     pstraxy (version,22,8,23);
  165.     pstraxy ("by Inge Vabekk",44,15,23);
  166.     pstraxy ("Type (part of) BBS name to dial or",21,10,31);
  167.     pstraxy ("'@list' ('list' contains names) or",21,11,31);
  168.     pstraxy ("'!' (alone) for dialing directory:",21,12,31);
  169.     pstraxy (".........................",25,13,87);
  170.     gotoxy(25,13);
  171.     _back_color = 4;
  172.     _fore_color = 15;
  173.     update_term();
  174.  
  175.     gets(name,25);                       // Get the name. 
  176.     for (i=strlen(name)-1; i>=0; --i)
  177.     { if (subchr(name,i) > ' ') break;   // Strip off spaces.
  178.       setchr(name,i,0);
  179.     }
  180.     blue();
  181.  
  182.     if (name=="!")                       // Abort requested?
  183.     { _qdbar_on = 0;                     // So 
  184.       dial ("",5,0);                     // display dialing directory.
  185.       i = 0;                             // Abort requested.
  186.       goto quit;
  187.     }
  188.   }
  189.   call (global,"W",bbsname,name);        // Set name of BBS to call.
  190.  
  191.   if (getenv ("SQRTIME",startime))       // Get start time for calling.
  192.   { _scr_chk_key = 0;                    // Check that time string is legal.
  193.     if (!isdigit(subchr(startime,0))) goto dcall;
  194.     if (!isdigit(subchr(startime,1))) goto dcall;
  195.     if (subchr(startime,2)!=':') goto dcall;
  196.     if (!isdigit(subchr(startime,3))) goto dcall;
  197.     if (!isdigit(subchr(startime,4))) goto dcall;
  198.     setchr(startime,5,0);
  199.     pstraxy ("  Waiting till clock strikes 00.00.00 ...  ",13,10,116);
  200.     pstraxy (startime,42,10,116);
  201.     do
  202.     { time (curtime(),temp);             // Get the time.
  203.       pstraxy (temp,30,11,113);
  204.       pstraxy ("",0,0,17);
  205.       delay(5);                          // Wait 1/2 sec.
  206.       if (inkey()==27) break;
  207.       setchr(temp,5,0);
  208.     } whil